﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using WL_Store.Model;

namespace WL_Store.DAL
{
   public  class AmountsDAL
    {
        /// <summary>
        /// 查询所有交易金额信息
        /// </summary>
        /// <returns></returns>
        public List<AmountsModel> GetAmounts()
        {
            string sql = @"select DalId,OrderId,DealTime,Turnover,State from Deal";

            List<AmountsModel> list = new List<AmountsModel>();
           SqlDataReader reader= Dbhelper.ExecuteReader(sql);
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    AmountsModel model = new AmountsModel()
                    {
                        DalId = Convert.ToInt32(reader["DalId"]),
                        OrderId = reader["OrderId"].ToString(),
                        DealTime = Convert.ToDateTime(reader["DealTime"]),
                        Turnover=Convert.ToDouble(reader["Turnover"]),
                        State = reader["State"].ToString(),
                    };
                    list.Add(model);
                }
                reader.Close();
            }
            return list;


        
        }



    }
}
